{  Statement: http://acmp.ru/?main=task&id_task=96
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i, j, n, m, x, y, dx, dy, ans : longint;
    a : array[0..110, 0..110] of boolean;
    
begin
    reset(input,'input.txt');
    rewrite(output,'output.txt');
    read(n, m, x, y);
    fillchar(a, sizeof(a), 0);
    ans := 1;
    for i := 1 to n do
        for j := 1 to m do
            a[i][j] := true;
    i := 1;
    j := 1;
    dx := 0;
    dy := 1;
    while (i <> x) or (j <> y) do begin
        inc(ans, byte(a[i][j]));
        a[i][j] := false;
        inc(i, dx);
        inc(j, dy);
        if not a[i][j] then begin
            dec(i, dx);
            dec(j, dy);
            if (dx = 0) and (dy = 1) then begin
                dx := 1;
                dy := 0;
            end else
            if (dx = 1) and (dy = 0) then begin
                dx := 0;
                dy := -1;
            end else
            if (dx = 0) and (dy = -1) then begin
                dx := -1;
                dy := 0;
            end else
            if (dx = -1) and (dy = 0) then begin
                dx := 0;
                dy := 1;
            end;
        end;
    end;
    write(ans);
end.
